<template>
  <div class="air">
    <h2 class="airTitle">
      <span class="iconfont icon-feiji"></span>
      国内机票
    </h2>
    <div class="airMain">
      <searchForm />
      <div class="airSideBanner">
        <img src="http://157.122.54.189:9093/images/pic_sale.jpeg" alt />
      </div>
    </div>
    <div class="statement">
      <div class="item">
        <i class="iconfont icon-renzheng"></i>
        <span>100%航协认证</span>
      </div>
      <div class="item">
        <i class="iconfont icon-baozheng"></i>
        <span>出行保证</span>
      </div>
      <div class="item">
        <i class="iconfont icon-dianhua"></i>
        <span>7x24小时服务</span>
      </div>
    </div>
    <h2 class="saleTitle">
      <span class="iconfont icon-feiji1"></span>
      特价机票
    </h2>
    <div class="saleAirShow">
      <nuxt-link
        :to="`/air/flights?departCity=${item.departCity}&departCode=${item.departCode}&destCity=${item.destCity}&destCode=${item.destCode}&departDate=${item.departDate}`"
        class="item"
        v-for="(item,index) in saleAirList"
        :key="index"
      >
        <img :src="$axios.defaults.baseURL+item.cover" alt />
        <div class="layerBar">
          <span>{{item.departCity}}-{{item.destCity}}</span>
          <span>￥{{item.price}}</span>
        </div>
      </nuxt-link>
    </div>
  </div>
</template>

<script>
import searchForm from "@/components/air/searchForm";
export default {
  components: {
    searchForm,
  },
  data() {
    return {
      saleAirList: [],
    };
  },
  //可以进行seo优化，这只做title变化
  head() {
    return {
      title: "国内机票",
    };
  },
  created() {
    this.getSaleAir();
  },
  methods: {
    getSaleAir() {
      this.$axios({
        url: "/airs/sale",
      }).then((res) => {
        this.saleAirList = res.data.data;
      });
    },
  },
};
</script>

<style lang="less" scoped>
.air {
  width: 1000px;
  margin: 0 auto;
  .airTitle,
  .saleTitle {
    color: #ffa500;
    font-size: 20px;
    font-weight: 400;
    margin: 15px 0;
    padding-left: 20px;
    .icon-feiji,
    .icon-feiji1 {
      font-size: 20px;
    }
  }
  .saleTitle {
    color: #409eff;
  }
  .airMain {
    display: flex;
  }
  .statement {
    height: 58px;
    background: #f5f5f5;
    margin: 15px 0;
    display: flex;
    padding: 10px 0;
    border: 1px solid #ddd;
    .item {
      flex: 1;
      text-align: center;
      line-height: 38px;
      border-right: 1px solid #ddd;

      &:last-child {
        border-right: none;
      }
      i {
        font-size: 30px;
        vertical-align: middle;
      }
      .icon-renzheng {
        color: #409eff;
      }
      .icon-baozheng {
        color: #008000;
      }
      .icon-dianhua {
        color: #409eff;
      }
    }
  }
  .saleAirShow {
    padding: 20px;
    border: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    margin-bottom: 50px;
    .item {
      width: 225px;
      height: 140px;
      position: relative;
      img {
        width: 100%;
        height: 100%;
        display: block;
      }
      .layerBar {
        position: absolute;
        height: 30px;
        line-height: 30px;
        left: 0;
        bottom: 0;
        right: 0;
        color: #fff;
        display: flex;
        justify-content: space-between;
        padding: 0 10px;
        background: rgba(0, 0, 0, 0.5);
        font-size: 14px;
      }
    }
  }
}
</style>